/*
 *  msw7/graphic2D.h
 *  mini
 *
 *  Created by jin on 1/1/11.
 *  Copyright 2011 cs. All rights reserved.
 *
 */

#ifndef INCLUDED_MSW7_GRAPHIC2D_H
#define INCLUDED_MSW7_GRAPHIC2D_H

#include <windows.h>
#include <graphic2D.h>
#include <d2d1.h>

class MSW7Graphic2D : public Graphic2D
{
public:
    static ID2D1Factory *pD2DFactory;
    static bool Init();

    MSW7Graphic2D();
    virtual ~MSW7Graphic2D();

    virtual void clear_rect(float x, float y, float w, float h);
    virtual void draw_line(float x0, float y0, float x1, float y1);

    void Resize(int width, int height);
    void BeginDraw();
    HRESULT EndDraw();
    HRESULT CreateDeviceResources(HWND);
    void DiscardDeviceResources();

private:
    ID2D1HwndRenderTarget *m_pDCRT;
    ID2D1SolidColorBrush *m_pBlackBrush;
};

#endif //INCLUDED_WINDOW_H
